﻿namespace WordCloudClient.ViewModels
{
    class WinAboutSystemViewModel : WinBaseVM
    {
        public DelegateCommand<object> ExcuteShieldClickDelegateCommand { get; private set; }
        public WinAboutSystemViewModel(SystemService systemService, WinEditHelper winEditHelper) : base(systemService, winEditHelper)
        {
            ExcuteShieldClickDelegateCommand = new DelegateCommand<object>(ExcuteShieldClick);
        }
        private string _systemName = string.Empty;
        public string SystemName
        {
            get { return _systemName; }
            set
            {
                _systemName = value;
                RaisePropertyChanged(nameof(SystemName));
            }
        }
        public override void OnDialogOpened(IDialogParameters parameters)
        {
            Title = parameters.GetValue<string>("Title");
            SystemName = _systemService.GetDictionaryValueByCode("SystemName").Value;
        }
        public void ExcuteShieldClick(object o)
        {
            if (o is string param)
            {
                string webSite = _systemService.GetDictionaryValueByCode(param).Value;
                CommonHelper.OpenFileByExplorer(webSite);
            }
        }
    }
}
